﻿<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="Bookmark" href="/favicon.ico" >
	<link rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
{include file="public/css"}
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<style type="text/css">
	a{
		cursor: pointer;
		display: inline-block;
		text-align: center;
		color: rgb(102, 102, 102);
		height: 26px;
		line-height: 26px;
		text-decoration: none;
		font-size: 14px;
		border-width: 1px;
		border-style: solid;
		border-color: rgb(204, 204, 204);
		border-image: initial;
		margin: 0px 0px 6px 6px;
		padding: 0px 10px;
	}
	.page-container table tbody tr td{
		text-align: center;
	}
</style>
<title>数据备份列表</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 
		<span class="c-gray en">&gt;</span> 数据管理 
		<span class="c-gray en">&gt;</span> 数据备份列表 
		<a class="btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
			<i class="Hui-iconfont">&#xe68f;</i>
		</a>
	</nav>
	<div class="page-container">
		<div class="cl pd-5 bg-1 bk-gray mt-20"> 
			<span class="l">
				<a data-type="backup" class="btn radius" data-msg="" data-name="" style="cursor:pointer;background:#19a97b;color:#fff"><i class="Hui-iconfont">&#xe600;</i>添加备份</a>
			</span>
			<span class="r">共有数据：<strong>{:count($list)}</strong> 条</span>
		</div>
		<table class="table table-border table-bordered table-bg">
			<thead>
				<tr>
					<th scope="col" colspan="9">管理员列表</th>
				</tr>
				<tr class="text-c">
					<!-- <th width="25"><input type="checkbox" value=""></th> -->
					<th width="40">编号</th>
					<th>文件名称</th>
					<th>文件大小</th>
					<th>备份时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				{volist name="list" id="l"}
				<tr>
					<td>{$key}</td>
					<td>{$l.name}</td>
					<td>{$l.fileSize}</td>
					<td>{$l.fileTime}</td>
					<td align="center">
						<a class="btn-danger" href="{:url('DownloadFile',array('name'=>$l.name))}" style="cursor:pointer;">下载备份文件&nbsp;&nbsp;</a>
						<a class="btn btn-danger" data-type="restore" data-msg="还原数据前请做好数据备份！" data-name="{$l.name}" style="cursor:pointer;">&nbsp;还原备份文件&nbsp;</a>
						<a class="btn btn-danger" data-type="delete" data-msg="确定删除备份数据？" data-name="{$l.name}" style="cursor: pointer;">&nbsp;&nbsp;删除</a>
					</td>
				</tr>
				{/volist}
			</tbody>
		</table>
	</div>
	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript" src="/demo/js/jquery.min.js"></script>
	<script type="text/javascript" src="/demo/layer3.1.0/layer/layer.js"></script>
	<script type="text/javascript">
		function database(type,name){
			var index = layer.load(1, {shade: [0.1,'#fff']}); //0.1透明度的白色背景
			$.get("{:url('index')}",{type:type,name:name},function(res){
				//console.log(type);console.log(name);
				console.log(res);
				layer.close(index);
				if (res.state==200) {
					layer.msg(res.msg,{icon:1,time:1500},function(){
						location.reload();
					});
				}else{
					layer.msg(res.msg,{icon:2});
				}
			})
		}
		$(".btn").click(function(){
			var msg=$(this).attr("data-msg");
				type=$(this).attr("data-type");
				name=$(this).attr("data-name");
			if (msg!='') {
				var confirm=layer.confirm(msg,{btn:['确定','取消']},function(){
					layer.close(confirm);
					database(type,name);
				})
			}else{
				database(type,name);
			}
		})
	</script>
</body>
</html>